package lagou.homework.lagouhomework.Unit2.q3.code;
/**
 * 通话套餐类 特征：通话时长、短信条数、每月资费 行为: 显示所有套餐信息
 *
 * */
public class CallPackage extends Packages implements CallService {
    private int  callTime;      // 通话时长
    private int messageCnt;     // 短信条数
    // private double  charges;    // 每月资费,继承自套餐类（Packages）

    public CallPackage() {
    }

    public CallPackage(int callTime, int messageCnt, double charges) {
        setCallTime(callTime);
        setMessageCnt(messageCnt);
        setCharges(charges);
    }

    public int getCallTime() {
        return callTime;
    }

    public void setCallTime(int callTime) {
        this.callTime = callTime;
    }

    public int getMessageCnt() {
        return messageCnt;
    }

    public void setMessageCnt(int messageCnt) {
        this.messageCnt = messageCnt;
    }
/**  // 继承自套餐类
    public double getCharges() {
        return charges;
    }

    public void setCharges(double charges) {
        this.charges = charges;
    }

 */
    @Override
    public void showInfo() {
        System.out.println("通话套餐中本月通话时长:" + getCallTime() + ",短信条数为：" + getMessageCnt() +", 资费为：" +getCharges());

    }
/** 重写了方法
    public void showCallPackage(){
        System.out.println("通话套餐中本月通话时长:" + getCallTime() + ",短信条数为：" + getMessageCnt() +", 资费为：" +getCharges());

    }
*/

    @Override
    public void callService(int callTime, PhoneCard phoneCard) {
        System.out.println("本次通话时长：" + callTime + "分钟" );
        // 通话完毕后重置通话时长
        phoneCard.setCallTime(phoneCard.getCallTime() + callTime);

    }
}
